﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ClassLibrary;
using System.Threading;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            //Chinese c = new Chinese()
            //{
            //    ID = 1,
            //    Name = "李四",
            //    Age = 18,
            //    Sex = false,
            //    Nationality = "中国"
            //};

            //c.SayHi();

            //Food f = new Food() { FoodName = "三明治" };
            //c.Eat(f);

            Action<string> a = xx;
            Func<string, long, DateTime,long> b = (x, y, t) => yy(x, y, t);

            for (int i = 0; i < 1; i++)
            {
                //a.BeginInvoke(i.ToString(),null,null);
                AsyncCallback cb = t => hh(t);
                IAsyncResult gg = b.BeginInvoke(i.ToString(), 888, DateTime.Now,cb, null);
               // long ii = b.EndInvoke(gg);
               //Console.WriteLine("结果:{0}", ii);
            }

            Console.Read();
        }

        private static void xx(string name)
        {
            Console.WriteLine("这是xx_{1},当前线程ID：{0}", Thread.CurrentThread.ManagedThreadId, name);
            Thread.Sleep(1120);
        }

        private static long yy(string name, long id, DateTime dt)
        {
            int rLong = 0;
            for (long i = 0; i < 9999; i++)
            {
                rLong++;
            }

            Console.WriteLine("name={0},执行完毕.", name);

            return rLong;
        }

        private static void hh<T>(T t)
        {
            Console.WriteLine("t is Type {0},Value = {1}",t.GetType(),t.ToString());
        }
    }
}
